package com.slt.seata.demo.s1.controller;

import com.slt.seata.demo.s1.domain.SysOperLog;
import com.slt.seata.demo.s1.service.SysOperLogMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;

@RestController
public class SysOperLogController {

    @Autowired
    private SysOperLogMapper sysOperLogMapper;


    @RequestMapping("/save")
    public Object save(String operName,String title){
        SysOperLog log=new SysOperLog();
        log.setTitle(title);
        log.setOperName(operName);
        sysOperLogMapper.insert(log);
//        if(true){
//            throw new RuntimeException("日志异常");
//        }
        return log;
    }
}
